<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div id="app">
  <h1>{{count}}</h1>
  <button v-on:click="sub">-</button>
  <!--  v-on:click 语法糖为 @click -->
  <button @click="add">+</button>
</div>


<script src="../js/vue.js"></script>
<script>
  // 1.创建Vue的实例对象
  const app = Vue.createApp({
    data(){
      return {
        count: 0,
      }
    },
    methods: {
      add(){
        this.count++;
      },
      sub(){
        this.count--;
      }
    }
  }).mount('#app');
</script>
</body>
</html>